package com.mlethe.android.demo.party;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * 微信支付实体
 *
 * @author Mlethe
 * @date 2018/4/4
 */
public class WechatPay implements Parcelable {
    /**
     * 微信appId
     */
    private String appid;
    /**
     * 商户号
     */
    private String partnerid;
    /**
     * 预支付交易会话ID
     */
    private String prepayid;
    /**
     * 扩展字段，暂填写固定值Sign=WXPay
     */
    private String packageValue;
    /**
     * 随机字符串
     */
    private String noncestr;
    /**
     * 时间戳
     */
    private long timestamp;
    /**
     * 签名
     */
    private String sign;

    public WechatPay(String appid, String partnerid, String prepayid, String packageValue, String noncestr, long timestamp, String sign) {
        this.appid = appid;
        this.partnerid = partnerid;
        this.prepayid = prepayid;
        this.packageValue = packageValue;
        this.noncestr = noncestr;
        this.timestamp = timestamp;
        this.sign = sign;
    }

    public String getAppid() {
        return appid;
    }

    public String getPartnerid() {
        return partnerid;
    }

    public String getPrepayid() {
        return prepayid;
    }

    public String getPackageValue() {
        return packageValue;
    }

    public String getNoncestr() {
        return noncestr;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public String getSign() {
        return sign;
    }

    @Override
    public String toString() {
        return "WechatPay{" +
                "appid='" + appid + '\'' +
                ", partnerid='" + partnerid + '\'' +
                ", prepayid='" + prepayid + '\'' +
                ", packageValue='" + packageValue + '\'' +
                ", noncestr='" + noncestr + '\'' +
                ", timestamp='" + timestamp + '\'' +
                ", sign='" + sign + '\'' +
                '}';
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.appid);
        dest.writeString(this.partnerid);
        dest.writeString(this.prepayid);
        dest.writeString(this.packageValue);
        dest.writeString(this.noncestr);
        dest.writeLong(this.timestamp);
        dest.writeString(this.sign);
    }

    public WechatPay() {
    }

    protected WechatPay(Parcel in) {
        this.appid = in.readString();
        this.partnerid = in.readString();
        this.prepayid = in.readString();
        this.packageValue = in.readString();
        this.noncestr = in.readString();
        this.timestamp = in.readLong();
        this.sign = in.readString();
    }

    public static final Creator<WechatPay> CREATOR = new Creator<WechatPay>() {
        @Override
        public WechatPay createFromParcel(Parcel source) {
            return new WechatPay(source);
        }

        @Override
        public WechatPay[] newArray(int size) {
            return new WechatPay[size];
        }
    };
}
